package com.ruoyi.user.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.user.mapper.UserComplaintsMapper;
import com.ruoyi.user.domain.UserComplaints;
import com.ruoyi.user.service.IUserComplaintsService;

/**
 * 用户投诉Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-10-21
 */
@Service
public class UserComplaintsServiceImpl implements IUserComplaintsService 
{
    @Autowired
    private UserComplaintsMapper userComplaintsMapper;

    /**
     * 查询用户投诉
     * 
     * @param complaintId 用户投诉主键
     * @return 用户投诉
     */
    @Override
    public UserComplaints selectUserComplaintsByComplaintId(String complaintId)
    {
        return userComplaintsMapper.selectUserComplaintsByComplaintId(complaintId);
    }

    /**
     * 查询用户投诉列表
     * 
     * @param userComplaints 用户投诉
     * @return 用户投诉
     */
    @Override
    public List<UserComplaints> selectUserComplaintsList(UserComplaints userComplaints)
    {
        return userComplaintsMapper.selectUserComplaintsList(userComplaints);
    }

    /**
     * 查询当前用户的投诉列表
     */
    @Override
    public List<UserComplaints> selectUserComplaintsListByCustomerId(String customerId)
    {
        return userComplaintsMapper.selectUserComplaintsListByCustomerId(customerId);
    }

    /**
     * 新增用户投诉
     * 
     * @param userComplaints 用户投诉
     * @return 结果
     */
    @Override
    public int insertUserComplaints(UserComplaints userComplaints)
    {
        return userComplaintsMapper.insertUserComplaints(userComplaints);
    }

    /**
     * 修改用户投诉
     * 
     * @param userComplaints 用户投诉
     * @return 结果
     */
    @Override
    public int updateUserComplaints(UserComplaints userComplaints)
    {
        return userComplaintsMapper.updateUserComplaints(userComplaints);
    }

    /**
     * 批量删除用户投诉
     * 
     * @param complaintIds 需要删除的用户投诉主键
     * @return 结果
     */
    @Override
    public int deleteUserComplaintsByComplaintIds(String[] complaintIds)
    {
        return userComplaintsMapper.deleteUserComplaintsByComplaintIds(complaintIds);
    }

    /**
     * 删除用户投诉信息
     * 
     * @param complaintId 用户投诉主键
     * @return 结果
     */
    @Override
    public int deleteUserComplaintsByComplaintId(String complaintId)
    {
        return userComplaintsMapper.deleteUserComplaintsByComplaintId(complaintId);
    }

    /**
     * 根据投诉ID与用户ID查询投诉详情（归属校验）
     */
    @Override
    public UserComplaints selectUserComplaintByIdAndCustomer(String complaintId, String customerId)
    {
        return userComplaintsMapper.selectUserComplaintByIdAndCustomer(complaintId, customerId);
    }

    /**
     * 根据投诉ID与用户ID软删除（撤销）投诉
     */
    @Override
    public int softDeleteUserComplaintByIdAndCustomer(String complaintId, String customerId, java.util.Date deletedAt, java.util.Date updatedAt)
    {
        return userComplaintsMapper.softDeleteUserComplaintByIdAndCustomer(complaintId, customerId, deletedAt, updatedAt);
    }
}
